﻿@model CustomerRewardPointsModel

@using SmartStore.Web.Models.Customer;

@{
	Html.AddTitleParts(T("PageTitle.Account").Text);

	Layout = "_MyAccount";
	ViewBag.PageClassToken = "rewardpoints";
	ViewBag.PageTitle = T("Account.RewardPoints").Text;
}

<div class="alert alert-info">
    @Model.RewardPointsBalance
</div>

<fieldset class="content-group mt-4">
    <legend class="mb-0"><span>@T("RewardPoints.History")</span></legend>
    <div class="reward-points-history">
        @if (Model.RewardPoints.Count == 0)
		{
			<div class="alert alert-warning mt-3">
				@T("RewardPoints.NoHistory")
			</div>
		}
		else
		{
			<div class="table-responsive">
				<table class="table table-striped table-hover">
					<thead>
						<tr>
							<th class="border-top-0">
								@T("Common.CreatedOn")
							</th>
							<th class="border-top-0">
								@T("RewardPoints.Fields.Points")
							</th>
							<th class="border-top-0">
								@T("RewardPoints.Fields.PointsBalance")
							</th>
							<th class="border-top-0">
								@T("RewardPoints.Fields.Message")
							</th>
						</tr>
					</thead>
					<tbody>
						@for (int i = 0; i < Model.RewardPoints.Count; i++)
						{
							var item = Model.RewardPoints[i];
							<tr>
								<td>
									@item.CreatedOn.ToNativeString()
								</td>
								<td>
									@item.Points.ToString("N0")
								</td>
								<td>
									@item.PointsBalance.ToString("N0")
								</td>
								<td dir="auto">
									@item.Message
								</td>
							</tr>
						}
					</tbody>
				</table>
			</div>			
        }
    </div>
</fieldset>
